package com.mianshi;

import java.util.Scanner;

public class alibaba {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        for(int i = 0; i < num; i++){
            int n = in.nextInt();
            int k = in.nextInt();
            int ans = 0;
            for(int x = 1; x <= n; x++){
                for(int y = 1; y <= n; y++){
                    if(x % y == k){
                        ans++;
                    }
                }
            }
            System.out.println(ans);
        }

    }
}
